<?php
/**
 * goal: publish new articles
 */
 session_start();
 require('includes/connect.php');
// require('checksessionlogin.php');
?>

<html>
    <head>
        <title>Administrator</title>
        <style type="text/css">
            body{
                margin: 0px auto;
                width: 960px;
                border: 2px solid #cccccc;
                -moz-boder-radius: 15px;
                line-height: 1.6;
            }                
        </style>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
        <link rel="stylesheet" href="css/adminStyle.css"/>
        <script language="Javascript" src="../scripts/innovaeditor.js"></script>
        <script language="javascript" type="text/javascript" src="../js/datetimepicker.js"></script>
    </head>
    
    <body>
        <div id="header">
            <div class="logo"></div>
            <div id="logout">
                <ul>
                    <li><a href="../index.php">Home</a></li>
                    <li><a href="#">Logout</a></li>
                </ul>               
            </div>
        </div>
        
            <form name="f" action="publish_article_action.php" method="post">
                <fieldset align="center" border="1">
                    <legend><b><i>Add Article Form</i></b></legend>
                <table align="center" width="95%" border="1" cellpadding="2" cellspacing="0">
                    <tr>
                        <th align="right">Title:</th>
                        <td><input type="text" name="title" size="80"</td>
                    </tr>

                    <tr>
                        <th align="right">Description:</th>
                        <td>
                            <textarea rows="5" cols="50" name="desciption"></textarea>
                        </td>
                    </tr>                    
                    <tr>
                        <th align="Right">Image:</th>
                        <td>
                            <input type=text style="width:200px;" name="image" id="image">
                            <input type="button" onClick="window.open('browse_add.php','','scrollbars=1,width=500,height=500');" value="Browse">	
                            <input type="button" onClick="window.open('upload_add.php','','width=300,height=200');" value="Upload">                        </td>
                    </tr>

                    <tr>
                        <th align="Right">Content:</th>
                        <td width="285">
                            <textarea name="content" cols="28" rows="5" id="content"></textarea>
                            <script>
                                var oEdit1 = new InnovaEditor("oEdit1");
                                oEdit1.width="760px";
                                oEdit1.height="250px";
                                oEdit1.REPLACE("content");
                            </script>
                        </td>
                    </tr>

                    <tr>
                        <th align="Right">author:</th>
                        <td>
                            <input type="text" name="author" size="80"></input>
                        </td>
                    </tr>

                    <tr>
                        <th align="Right">Date:</th>
                        <td>
                            <input name="date" id="date" type="text" size="35"></input><a href="javascript:NewCal('date','ddmmyyyy')"><img src="../images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
                        </td>
                    </tr>

                    <tr>
                        <th align="Right">Statement:</th>
                        <td>
                            <select name="statement" id="statement">
                                <option value="1">Enabled</option>;
                                <option value="0">Disabled</option>;                                
                            </select>
                        </td>
                    </tr>

                    <tr>
                        <td align="right"><input type="submit" value="Publish" onclick="checkValue();" align="right"/></td>
                        <td><input type="reset" value="Reset" align="left"></td>
                    </tr>
                    <script languge="javascript">
                    function checkValue()
                    {
                        if(f.title.valueOf() == '') {
                            alert('You need to fill in your article tile');
                            f.title.focus();
                            return false;
                        }
                        if(f.Content.valueOf() == '') {
                            alert('Article does not have content');
                            f.title.focus();
                            return false;
                        }
                        confirm('You really want to publish ?');
                        return true;
                    }
                    </script>

                </table>   
                </fieldset>
            </form>

			
            <div class="footer-admin">
                <h3 align="center"><a href="index.php">Contact us</a<></h3>
            </div>
            
        </body>
</html>
